<template>
	<view class="zlSuccessTips">
		<view class="main">
			<view class="title"> 找零 </view>
			<view class="money_total">
				{{ `正在为您找零 $ 50 * ${zlCount(change) || 0} 圆` }}
			</view>
			<div class="btn_box">
				<view v-show="count !== 0" class="btn">确定</view>
				<view v-show="count === 0" class="btn" @click="confirm">确定</view>
			</div>
		</view>
	</view>
</template>

<script>
	import useStore from '@/store/index.js';
	import {
		saveSlotLog
	} from '@/api/order';
	import {
		zbCode,
		ybCode,
		zlCode,
		stateCode
	} from '@/config/code';
	import {
		countZLSend
	} from '@/utils/countMoney';
	export default {
		props: {
			payable: {
				default: 0,
			},
			change: {
				default: 0, // 应找零
			},
			orderNo: {
				default: '',
			},
		},
		data() {
			return {
				count: 0,
				total: 0,
			};
		},
		mounted() {},
		methods: {
			jump(data) {
				let url = '';
				switch (data) {
					case 'service':
						url = '/pages/service/service';
						break;
					default:
				}
				uni.navigateTo({
					url,
				});
			},
			isNeedCoin() {
				const {
					order
				} = useStore();
				const needPayMoney = 200;
			},
			async zlCount(total) {
				const count = total / 50 || 0;
				this.count = count;
				// 后台通信记录投币记录

				const params = {
					store_id: equipmentOptions.store_id,
					order_no: this.$props.orderNo,
					equipmentID: equipmentID.equipmentID,
					amount: this.$props.payable,
					amount_type: 2,
					type: 2,
					num: 1,
					denomination: 50,
				};
				// await saveSlotLog(params).then(res => {});
				return count;
			},
			cancel() {},
			confirm() {
				this.$emit('handClose', 'zlPending');
			},
		},
	};
</script>

<style lang="scss" scoped>
	.zlSuccessTips {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 99;
		width: 100%;
		height: 100%;
		background: rgba(0, 0, 0, 0.5);
		display: flex;
		justify-content: center;
		align-items: center;

		.main {
			// width: 100%;
			// height: 100%;
			padding: 30rpx 60rpx;
			border: 2rpx solid $uni-color-green;
			border-radius: 10rpx;
			color: $uni-color-green;
			background-color: $uni-color-white;
			display: flex;
			flex-direction: column;
			justify-content: space-between;

			.title {
				width: 400rpx;
				height: 150rpx;
				text-align: center;
				line-height: 150rpx;
			}

			.money_total {
				height: 100rpx;
				text-align: center;
				line-height: 100rpx;
			}

			.btn_box {
				width: 400rpx;
				height: 100rpx;
				display: flex;
				justify-content: center;

				.btn {
					height: 30rpx;
					padding: 20rpx;
					line-height: 1;
					border-radius: 10rpx;
					color: $uni-color-white;
					background-color: $uni-color-green;
				}
			}
		}
	}
</style>